package com.example.springboot.exception;

import com.example.springboot.common.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 功能
 * 作者：程序员小白
 * 日期：2024-11-15 9:40
 */
@ControllerAdvice
public class GloboException {
    @ExceptionHandler(ServiceException.class)
    @ResponseBody
    public Result exception(ServiceException e){
        return Result.error("500",e.getMessage());
    }
}
